/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.support.cservice;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.AsyncTask;
import android.view.animation.AlphaAnimation;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;
import android.widget.ProgressBar;

public class ViewAttachmentLayout extends FrameLayout {
    private Activity a;
    private ImageView b;
    private ProgressBar c;

    public ViewAttachmentLayout(Context paramContext) {
        super(paramContext);
        this.a = ((Activity) paramContext);
        a();
    }

    private void a() {
        setBackgroundColor(Color.argb(125, 125, 125, 125));
        this.b = new ImageView(this.a);
        FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(-2, -2);
        localLayoutParams.gravity = 17;
        addView(this.b, localLayoutParams);
        this.c = new ProgressBar(this.a);
        localLayoutParams = new FrameLayout.LayoutParams(-2, -2);
        localLayoutParams.gravity = 17;
        addView(this.c, localLayoutParams);
    }

    public void setImage(String paramString) {
        new AsyncTask() {
            protected Bitmap a(String[] paramArrayOfString) {
                return BitmapFactory.decodeFile(paramArrayOfString[0]);
            }

            protected void a(Bitmap paramBitmap) {
                ViewAttachmentLayout.a(ViewAttachmentLayout.this).setImageBitmap(paramBitmap);
                ViewAttachmentLayout.a(ViewAttachmentLayout.this).startAnimation(new AlphaAnimation(0.0F, 1.0F));
                ViewAttachmentLayout.this.removeView(ViewAttachmentLayout.b(ViewAttachmentLayout.this));
            }
        }.execute(new String[] { paramString });
    }
}